<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:a4j="http://richfaces.org/a4j">

<ui:composition template="/views/templates/main.xhtml">
	<ui:define name="body">
		<style>
.navigation .rf-tab-hdr-brd,.navigation .rf-tab {
	display: none;
}
</style>
		<h:outputStylesheet>
.label {
    font-weight: bold;
}
.rf-dg, .rf-dg-c{
    border:none;
}
.pbody {
    width: 180px;
}
</h:outputStylesheet>
	 		<h:form>
			<rich:panel>
				<f:facet name="header">
					<h:panelGroup>
						<h:outputText value="Edición del perfil" />
					</h:panelGroup>
				</f:facet>
				<h:panelGrid columns="3">
					<h:outputText value="Nombre:" />
					<h:inputText value="#{userBean.name}" id="name" validatorMessage="Nombre incorrecto">
						<f:validateLength minimum="3" maximum="20" />
					</h:inputText>
					<rich:message for="name" />
					<h:outputText value="Apellido:" />
					<h:inputText value="#{userBean.surname}" id="surname" validatorMessage="Apellido incorrecto">
						<f:validateLength minimum="3" maximum="20" />
					</h:inputText>
					<rich:message for="surname" />
					<h:outputText value="Fecha de nacimiento:" />
					<rich:calendar id="bornDate" datePattern="dd/MM/yyyy" value="#{userBean.bornDay}" />
					<rich:message for="bornDate" />
					<h:outputText value="Sexo:" />
					<h:selectOneRadio id="sex" value="#{userBean.sex}" valueChangeListener="#{userBean.sex}">
						<f:selectItem itemLabel="F" itemValue="F" />
						<f:selectItem itemLabel="M" itemValue="M" />
					</h:selectOneRadio>
					<rich:message for="sex" />
					<h:outputText value="Password:" />
					<h:inputSecret id="password" value="#{userBean.password}" redisplay="true" required="true"
						validatorMessage="Formato de mail incorrecto">
						<f:validateLength minimum="8" />
					</h:inputSecret>
					<rich:message for="password" />
					<h:outputText value="Confirmacion Password:" />
					<h:inputSecret id="password2" value="#{userBean.confirmPassword}" required="true" redisplay="true" validator="#{userBean.validatePassword}">
					</h:inputSecret>
					<rich:message for="password2" />
					<h:outputText value="Pais:" />
					<rich:select reRender="city" id="country" value="#{userBean.country}" enableManualInput="true" defaultLabel="">
						<f:selectItems value="#{userBean.countries}" />
						<f:ajax event="selectitem" render="city" />
					</rich:select>
					<rich:message for="country" />
					<h:outputText value="Ciudad:" />
					<rich:select id="city" value="#{userBean.city}" enableManualInput="true" defaultLabel="">
						<f:selectItems value="#{userBean.cities}" />
					</rich:select>
					<rich:message for="city" />
					
				</h:panelGrid>
				<rich:fileUpload addControlLabel="Seleccionar Imagen"
					    listHeight="0px" listWidth="321px"
					    fileUploadListener="#{userBean.listener}"
						maxFilesQuantity="#{userBean.uploadsAvailable}" 
						id="upload" 
						immediateUpload="#{userBean.autoUpload}"
						acceptedTypes="jpg, gif, png, bmp" 
						allowFlash="#{userBean.useFlash}" 
						maxRequestSize="10"
						>
				</rich:fileUpload>
			</rich:panel>
			<br />
			<h:commandButton id="ingresar" type="submit" value="Ingresar" action="#{userBean.update_ON_CLICK}" />
			<rich:message for="ingresar" />
		</h:form>   
</ui:define>
</ui:composition>
</html>